<template>
  <div id="visitFile" class="person-detail">
    <div>
      <van-nav-bar
        title="就诊档案"
        :fixed="true"
        left-arrow
        @click-left="back"
      />
    </div>
    <div class="medicalRecord-body">
      <div class="medicalRecord-big medicalRecord-line">
        我的档案
      </div>
      <div class="">
        <van-pull-refresh
          v-model="isLoading"
          success-text="刷新成功"
          @refresh="onRefresh"
        >
          <div
            v-for="(item, index) in feedBackContentList"
            :key="index"
            class="medicalRecord-details medicalRecord-line"
            @click="
              $router.push({ path: '/work/communityHealth/medicalRecord' ,query:{id:item.id}})
            "
          >
            <div>
              <van-image
                :src="item.headImage"
                alt=""
                round
                width="2rem"
                height="2rem"
              />
            </div>
            <div>
              <p class="medicalRecord-big">{{ item.username }}</p>
              <p>性别:{{ item.gender == '1' ? '男' : '女' }}</p>
              <p>年龄:{{ item.age }}</p>
              <p>档案号:{{ item.archiveCode }}</p>
            </div>
          </div>
        </van-pull-refresh>
      </div>
      <div class="mine-out">
        <van-button
          type="default"
          @click="$router.push({ path: '/work/communityHealth/fileBinding' })"
          >添加</van-button
        >
      </div>
    </div>
  </div>
</template>
<script>
import mine from "../../../../controller/mine";
export default {
  name: "visitFile",
  components: {},
  data() {
    return {
      count: 1,
      isLoading: false,
      feedBackContentList: [
      ]
    };
  },
  computed: {},
  created() {},
  mounted() {
    this.getInfo();
  },
  methods: {
    onRefresh() {
      this.count++;
      this.getInfo();
    },
    getInfo() {
      let data = {
        curPage: this.count,
        pageSize: (this.count) * 5
      };
      mine.medicalArchive_v1_list_frontEnd(data).then(res => {
        this.isLoading = false;
        if (res.code == "0") {
          if (res.datas != null) {
            if (this.count > 1) {
              this.feedBackContentList = res.datas.records.concat(
                this.feedBackContentList
              );
            } else {
              this.feedBackContentList = [];
              this.feedBackContentList = res.datas.records;
            }
          }
        } else {
          this.$toast(res.msg);
        }
      });
    },
    back() {
      this.$router.go(-1);
    }
  }
};
</script>
<style lang="scss" scoped>
#visitFile {
  p {
    margin: 7px 0;
  }
  background: #fff;
  .medicalRecord-body {
    img {
      width: 100px;
      height: 100px;
    }
    > div:nth-child(2) {
      padding: 5px 0;
    }
  }
  .medicalRecord-big {
    font-size: 16px;
    font-weight: 600;
  }
  .medicalRecord-details {
    display: flex;
    > div:nth-child(2) {
      margin-left: 10px;
      > p:nth-child(2),
      > p:nth-child(3),
      > p:nth-child(4) {
        font-weight: 300;
      }
    }
  }
  .myResume-add {
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
  }
  .medicalRecord-line {
    border-bottom: 1px solid #e2e2e2;
    padding: 10px 20px;
  }
  .mine-out {
    padding: 50px 0;
    button {
      width: 80%;
      height: 80%;
      margin: auto;
      display: block;
      font-size: 20px;
      color: #fff;
      letter-spacing: 0;
      text-align: center;
      background: #dc4630;
      border-radius: 20px;
    }
  }
}
</style>
